/* 
 *  Copyright (c) 2011—2013 Panguso.com. All rights reserved. 
 *  File Name:  XMLNode.java                                      
 *  File Contents Outline :  XML节点                  
 *  File  Create Date:   2012年7月30日
 *  File Version#: Revision#: #1                  
 *  File  Latest Modify Date : 2013年1月16日
 *  File Author :  bachuan@panguso.com
 */
/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.tree;

/**
 * XML每个节点存储的内容
 * @author wan
 */
public class XMLNode {
   public static final String OPERATOR="operator";
   public static final String TRACE_OPERATOR="trace operator";
   public static final String TAGNAME="tag name";
   public static final String TAGFORMAT="tag format";
   public static final String STRINGTYPE="string type";
   public static final String LISTTYPE="list type";
   
   private String key;//id
   private String nodename;//nodename
   private String type;//nodetype
//   private String valuetype;
   private String value="";//nodetype0
   private String[] valueList;//nodetype1

   public XMLNode(String key,String nodename,String type){
       this.key=key;
       this.type=type;
       this.nodename=nodename;
       if(type.startsWith("tag format")){
           if(type.endsWith("0"))
               this.value=nodename;
           if(type.endsWith("1")){
               if(nodename.indexOf(",")<0){
                   valueList=new String[1];
                   valueList[0]=nodename;
               }
               else{   
                  valueList=nodename.split(",");      
                   
               }
           }
       }      
   }
    /**
     * @return the key
     */
    public String getKey() {
        return key;
    }

    /**
     * @param key the key to set
     */
    public void setKey(String key) {
        this.key = key;
    }

    /**
     * @return the nodename
     */
    public String getNodename() {
        return nodename;
    }

    /**
     * @param nodename the nodename to set
     */
    public void setNodename(String nodename) {
        this.nodename = nodename;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * @param value the value to set
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * @return the valueList
     */
    public String[] getValueList() {
//        for(int i=0;i<valueList.length;i++){
//        System.out.println("valueList in XMLNode:"+valueList[i]);
//        }
        return valueList;
    }

    /**
     * @param valueList the valueList to set
     */
    public void setValueList(String[] valueList) {
        this.valueList = valueList;
    }  
}
